<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
</head>
<body>

<form class="layui-form" id="editRole" action="" style="margin-top: 15px;">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名</label>
        <div class="layui-input-block">
            <input type="text" name="name" required  lay-verify="required" placeholder="请输入角色名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <input type="text" name="describes"autocomplete="off" class="layui-input">
        </div>
    </div>

</form>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/layui/xm-select.js}"></script>
<script>

    layui.use(['form','jquery'], function() {
        var form = layui.form;
        var $ = layui.jquery;
        var id = `[[${id}]]`

        $.post("/selectRoleById",{id:id+""},function (res) {
            $("input[name='name']").val(res.data.name)
            $("input[name='describes']").val(res.data.describes)
        })

    })

</script>
</body>
</html>